package 作业;

public class MethodDemozuoye {
    public static void main(String[] args) {
        sayHi("250");
        sayHi("zhangsan");
        sayHi("lisi");
        sayHello("zhangsan",25);
        sayHello("lisi",27);
        double a = getNum();
        System.out.println(a);
        int b = plus(5,6);
        System.out.println(b);
        int m=5,n=6;
        int c = plus(m,n);
        System.out.println(c);
        int[] d = testArray(5,100);
        System.out.println("数组的长度为:"+d.length);
        for(int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }
        int[] e = testArray(8,20);
        System.out.println("第1个元素的值为:"+e[0]);
        for(int i=0;i<e.length;i++){
            System.out.println(e[i]);
        }
        sayHello("zhangsan",25);
        sayHello("lisi",66);

        aMethod();
        System.out.println(444);
}
       public static void aMethod(){
            System.out.println(111);
            bMethod();
            System.out.println(222);
        }
        public static void bMethod(){System.out.println(333);}





    public static void sayHello(String name,int age){
        if(age>60){
            return;
        }
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁了");
    }


    public static int[] testArray(int len,int max){
        int[] arr = new int[len];
        for(int i=0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*(max+1));
        }
        return arr;
    }


    public static int plus(int num1,int num2){
        int num = num1+num2;
        return num;

    }


    public static double getNum(){


        return 8.88;
    }


    public static void say(){
        System.out.println("大家好，我叫WKJ，今年39岁了");
    }
    public static void sayHi(String name){
        System.out.println("大家好，我叫"+name+"，今年39岁了");
    }


}



